from tortoise.models import Model
from tortoise import fields


class BaseModel(Model):
    __doc__ = "基础模型"
    id = fields.BigIntField(pk=True, description="主键")
    create_date = fields.DatetimeField(auto_now_add=True, null=False, description='创建时间')
    update_date = fields.DatetimeField(auto_now=True, null=False, description='更新时间')

    class Meta:
        abstract = True  # 表示抽象类 不会映射数据库表

    class PydanticMeta:
        exclude = ("create_date","update_date")
